package program;

import java.util.Scanner;

public class Boundary {
	private static Scanner input;
	String[] colorArray = {
			"null","Blue","Orange","GreenYellow","LightBlue",
			"Red","White","Yellow","Purple","Brewery","Shipping",};

	//Mangler at blive opdateret til N antal spillere.
	public String[] startGame(int numberOfPlayers){
		input = new Scanner(System.in);
		String[] name = new String[255]; 
		
		System.out.println("Please input the name of players");
		for(int i = 1; i <= numberOfPlayers; i++){
			System.out.println("Player "+i+":");
			name[i] = input.nextLine();
		}
//		System.out.println("Player 1:");
//		name[1] = input.nextLine();
//		System.out.println("Player 2:");
//		name[2] = input.nextLine();

		return name;
	}
	
	public int choosePlayers(){
		input = new Scanner(System.in);
		System.out.println("Welcome to the DTU matador game!");
		System.out.println("Please input the number of players:");
		return input.nextInt();
	}
	
	public String[] startRiggedGame(){
		input = new Scanner(System.in);
		String[] name = new String[255]; 

		System.out.println("\nWelcome to the DTU test matador game!");
		System.out.println("This game is rigged so that the expected values can be compared with the actual ones.");
		System.out.println("Please input the name of players");
		System.out.println("Player 1:");
		name[1] = input.nextLine();
		System.out.println("Player 2:");
		name[2] = input.nextLine();


		return name;
	}

	public void playerLost(String name){
		System.out.println("Player: " + name + " cant afford the bill, and is out of the game.");
	}

	public void playerWon(String name){
		System.out.println("Player: " + name + " now have more then 30000, and will win the game.");
	}

	public void gameWon(String winner){
		System.out.println("Player: "+winner+" Won the game!");
	}

	// Bliver k�rt hver gang en tur er slut.
	// acceptere parameterne spiller saldo, spiller navn, terning 1 og 2, og terning sum.
	public void gameStatus(int saldo, String name, int die1, int die2, 
			String fieldName, String fieldPayment, String fldOwnr, int fieldNr){
		System.out.println("Player: "+ name+ " threw a "+ die1 + " and "  + die2);
		System.out.println("Which landed " + name + " on:");
		if(fldOwnr.equals(name)){
			System.out.println("Field Nr: "+fieldNr+", "+fieldName);
		}
		else if (fldOwnr.equals("Bank")){
			System.out.println("Field Nr: "+fieldNr+", "+fieldName + " Value: "+fieldPayment);
		}
		else{
			System.out.println("Field Nr: "+fieldNr+", "+fieldName + " Pay: "+fieldPayment);
		}
		System.out.println("Saldo: " + saldo);
		if (fieldNr != 30)
		{
			emptySpace();
		}
		
	}
	
	public void statusAfterLuckycard(int saldo, String name, String fieldName, 
			String fieldPayment, String fldOwnr, int fieldNr)
	{
		System.out.println(name + " moved to field: " + fieldName);
		if(fldOwnr.equals(name)){
			System.out.println("Field Nr: "+fieldNr+", "+fieldName);
		}
		else if (fldOwnr.equals("Bank")){
			System.out.println("Field Nr: "+fieldNr+", "+fieldName + " Value: "+fieldPayment);
		}
		else{
			System.out.println("Field Nr: "+fieldNr+", "+fieldName + " Pay: "+fieldPayment);
		}
		System.out.println("Saldo: " + saldo);
		emptySpace();
	}

	public void emptySpace(){
		System.out.println("");
	}
	
	//Jail methodes:
	public int chooseJail(String player, boolean hasJailcard)
	{
		System.out.println(player + " is in jail. To exit, press:");
		System.out.println("1 to pay kr. 1000");
		System.out.println("2 roll a pair");
		if (hasJailcard)
		{
			System.out.println("3 use jailcard");
		}
		return input.nextInt();
	}

	public void jailPay(String player)
	{
		System.out.println(player + " chose to pay kr. 1000 to get out of jail.\n" + player + " moved to field Start.\n");
	}

	public void jailRollWin(String player, int dice)
	{
		System.out.println(player + " threw a pair of " + dice + " and is out of jail.\n" + player + " moved to field Start.\n");
	}

	public void jailRollLose(String player, int dice1, int dice2)
	{
		System.out.println(player + " threw " + dice1 + " and " + dice2 + " and stays in jail\n");
	}
	
	public void jailJailcard(String player)
	{
		System.out.println(player + " chose to use jailcard and is out of jail.\n" + player + " moved to field Start.\n");
	}

	public int turnEnd(String playername, int saldo, boolean showBuyMenu, boolean pair){
		if (pair)
		{
			System.out.println("Press 1 to throw dice");
		}
		else
		{
			System.out.println("Press 1 to end turn.");
		}
		if (showBuyMenu)
		{
			System.out.println("Press 2 to go to market menu.");
		}
		return input.nextInt();
	}

	//BuyMenu methodes:
	public void buyMenu(int saldo){
		System.out.println("~~Market menu~~");
		System.out.println("Saldo: "+saldo);
		System.out.println("Properties:");
	}
	
	public void buyFieldMenuColor(int color){
		System.out.println("");
		System.out.println(colorArray[color]+":");
	}
	
	public void buyFieldMenu(int fieldNr,int ownedFieldNr, int[][][] playerOwned, 
			int i, int k, int colorCounter, String color){
		System.out.println("Press "+ownedFieldNr+" to upgrade: "+"FieldNr: "+fieldNr+", color: "+color+
				", Number: "+colorCounter+", Property level: "+playerOwned[i][k][0]);
	}
	
	public void buyMenuChoice1(){
		System.out.println("Press 1337 to buy current field.");
	}
	
	public int buyMenuChoice2(){
		System.out.println("Press 0 to got back.");
		return input.nextInt();
	}
	
	public void smallLine(){
		System.out.println("--------------------");
	}
	
	public void luckycard(int cardType, int cardValue, String fieldName)
	{
		switch (cardType)
		{
		case 1: //Flyt x felter frems
			System.out.println("Luckycard: move " + cardValue + " field(s) forward\n");
			break;
		case 2: //Flyt x felter tilbage
			System.out.println("Luckycard: move " + cardValue + " field(s) back\n");
			break;
		case 3: //Få penge
			System.out.println("Luckycard: you will recieve an amount of " + cardValue + " kr.\n");
			break;
		case 4: //Træk penge
			System.out.println("Luckycard: you must pay a sum of " + cardValue + " kr. to the bank\n");
			break;
		case 5: //Ryk til felt
			System.out.println("Luckycard: move to field " + fieldName + "\n");
			break;
		case 6: //Fængsel
			System.out.println("Luckycard: you are going to jail\n");
			break;
		case 7: //Jailcard
			System.out.println("Luckycard: you will recieve a jailcard\n");
			break;
		}
	}
	public void printSeperatorLine(){
		System.out.println("-------------------*Turn*-------------------");
	}
	
	public void movedToJail(String player)
	{
		System.out.println(player + " moved to field I fængsel\n");
	}
}